package SST.LIB;

/** 
 Account ��ժҪ˵����
*/
public class Account
{
	private int Uid = 0;
	public double OutMoney = 0;
	public double InMoney = 0;
	public double Balance = 0;
	public String OutMoneyStr = ""; //�����ܽ�
	public String InMoneyStr = "";
	public String BalanceStr = "";
	public String YonjenStr = "0";
	public Account(int uid)
	{
		//
		// TODO: �ڴ˴���ӹ��캯���߼�
		//
		Uid = uid;


		String text = "select *  from bank where zt='q' and hy_num=" + String.valueOf(Uid);
		System.Data.DataTable dt = MOLE.SQL.GetDataTable(text);
		if (dt.Rows.size() == 0)
		{
			OutMoneyStr = "0.00";
			InMoneyStr = "0.00";
			BalanceStr = "0.00";
		}
		else
		{
			double d = MOLE.str.ConvertToDouble(dt.Rows[0]["output_money"].toString().trim());

			OutMoneyStr = Math.abs(d).toString("0.00");
			InMoneyStr = (new Double(MOLE.str.ConvertToDouble(dt.Rows[0]["input_money"].toString()))).toString("0.00");
			BalanceStr = (new Double(MOLE.str.ConvertToDouble(dt.Rows[0]["balance"].toString().trim()))).toString("0.00");
			Balance = Double.parseDouble(BalanceStr);

		}
	}
	//		public Account(int uid)
	//		{
	//
	//
	//		}


	public final double GetYonjen()
	{
		return Double.parseDouble(OutMoneyStr) * GetFedyer();

	}


	public final double GetFedyer()
	{
		String s = "SELECT * FROM  [hy_login_info] where hy_id=" + String.valueOf(Uid);
		System.Data.DataTable dt = MOLE.SQL.GetDataTable(s);
		if (dt.Rows.size() == 0)
		{
			return 0;
		}
		else
		{
			return Double.parseDouble(dt.Rows[0]["tichengbili"].toString().trim());
		}
	}






	//
	public final double TisyeSum()
	{
		String text2 = "select sum(money) as summoney from bank_tixian where zt='\u5df2\u5904\u7406' and hy_num=" + String.valueOf(Uid);
		DataTable table2 = MOLE.SQL.GetDataTable(text2);
		if ((!table2.Rows[0]["summoney"].toString().equals("")) && (!table2.Rows[0]["summoney"].toString().equals("0")))
		{
			return Double.parseDouble(table2.Rows[0]["summoney"].toString());
		}
		else
		{
			return 0;
		}

	}



	public final double ZhongjangMoneySum()
	{
		String s = "sselect * from banklogView ";
		System.Data.DataTable dt = MOLE.SQL.GetDataTable(s);
		if (dt.Rows.size() == 0)
		{
			return 0;
		}
		else
		{
			String ss = dt.Rows[0]["summoney"].toString().trim();
			if (ss.equals(""))
			{
				return 0;
			}
			else
			{
				return Double.parseDouble(s);
			}

		}

	}

	public final java.math.BigDecimal GetYonjenTotalMoney()
	{
		java.math.BigDecimal r = new java.math.BigDecimal(0);
		String s = "GetYonjenTotalMoney " + String.valueOf(Uid);
		DataTable d = MOLE.SQL.GetDataTable(s);
			try
			{
				r = (java.math.BigDecimal)(d.Rows[0]["money"].toString());
			}
			catch (java.lang.Exception e)
			{
			}
		return r;

	}



}